//
//  HDSearchObj.m
//  HDWuDaDaoServiceCenter
//
//  Created by HDNiuKuiming on 2017/4/15.
//  Copyright © 2017年 HDNiuKuiming. All rights reserved.
//

#import "HDSearchObj.h"

@implementation HDSearchListObj

+ (instancetype)listObjWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict]; // 字典的快速赋值，需要特殊处理一下保留字段和未声明但是字典中有的字段
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if([key isEqualToString:@"id"]) {
    }
}

@end

@implementation HDSearchObj

+ (instancetype)searchObjWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if (self = [super init]) {
        [self setValuesForKeysWithDictionary:dict]; // 字典的快速赋值，需要特殊处理一下保留字段和未声明但是字典中有的字段
        [self arrayClean];
        _comment_infoArray = [NSMutableArray new];
        
        NSArray *infoArray = dict[@"comment_info"];
        for (NSInteger i=0;i<infoArray.count;i++) {
            NSDictionary *dic = infoArray[i];
            HDSearchListObj *listObj = [HDSearchListObj listObjWithDict:dic];
            [_comment_infoArray addObject:listObj];
        }
    }
    return self;
}

-(void)setValue:(id)value forUndefinedKey:(NSString *)key{
    if([key isEqualToString:@"id"]) {
    }
}

- (void)arrayClean
{
    [_comment_infoArray removeAllObjects];
    self.comment_infoArray = nil;
}

- (void)dealloc
{
    [self arrayClean];
}

@end
